﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ParserCore;

namespace TestParser
{
    [TestClass]
    public partial class ParserUnitTest
    {
        [TestMethod]
        public void test_2_plus_3()
        {
            var expression = "2+3";
            var parser = new ParsingEngine();
            var statement = parser.Parse(expression);
            Assert.AreEqual("+(2,3)", statement.ToString());
        }

        [TestMethod]
        public void test_2_plus_3_puta_5()
        {
            var expression = "2+3*5";
            var parser = new ParsingEngine();
            var statement = parser.Parse(expression);
            Assert.AreEqual("+(2,*(3,5))",statement.ToString());
        }

        //[TestMethod]
        //public void test_if_x_gt_5_then_a_eq_a_plus_3()
        //{
        //    var expression = "if x>5, a=a+3;end";
        //    var parser = new ParsingEngine();
        //    var statement = parser.Parse(expression);
        //    Assert.AreEqual(statement,
        //        new IfThenElseStatement(
        //                new Call(
        //                    new Identifier(">"),
        //                    new Identifier("x"),
        //                    new Constant("5")
        //                    ),
        //                new BlockStatement( 
        //                    new AssignmentStatement(
        //                        new Identifier("a"),
        //                        new Call(
        //                            new Identifier("+"),
        //                            new Identifier("a"),
        //                            new Constant("3")
        //                            )
        //                        )
        //                    ),
        //                new BlockStatement()
        //            ));
        //}
    }
}
